</div>
<!-- 放置JS结尾的文件，网页的加载速度更快 -->
<script src="/js/jquery-ui-1.9.2.custom.min.js"></script>
<script src="/js/jquery-migrate-1.2.1.min.js"></script>
<script src="/js/bootstrap.min.js"></script>
<script src="/js/modernizr.min.js"></script>
<script src="/js/jquery.nicescroll.js"></script>
<script src="/js/bootstrap-select.js"></script>


<!--pickers plugins-->
<script type="text/javascript" src="/js/previewImage.js"></script>
<script type="text/javascript" src="/js/jquery.form.js"></script>
<script type="text/javascript" src="/js/highcharts.js"></script>


<!--common scripts for all pages-->
<script src="/js/scripts.js"></script>
<script src="/js/layer.js"></script>
<!-- table js -->
<script src="/js/common/page.js"></script>

<!--data table-->
<script type="text/javascript" src="/js/data-tables/jquery.dataTables.js"></script>
<script type="text/javascript" src="/js/bootstrap-datetimepicker/js/bootstrap-datetimepicker.js"></script>
<script type="text/javascript" src="/js/bootstrap-datetimepicker/js/locales/bootstrap-datetimepicker.zh-CN.js"></script>
<script type="text/javascript" src="/js/data-tables/DT_bootstrap.js"></script>
<script src="/js/pickers-init.js"></script>
<!--common scripts for all pages-->
<script src="/js/scripts.js"></script>

<!--script for editable table-->
<script src="/js/editable-table.js"></script>

<!-- END JAVASCRIPTS -->
<?php
$Auth = new Application_Model_Auth();
$admin_id = $Auth ->getId();

echo '<input style="display:none;" value="'.$admin_id.'" id="order"  type="text" />'
?>

<script type="text/javascript">
    //定义全局的错误成功提示
    var msg = {
        error: function(message, foo){
            if (foo == undefined) {
                layer.msg(message, {icon: 2});
            } else {
                layer.msg(message, {icon: 2}, foo);
            }
        },
        success: function(message, foo){
            if (foo == undefined) {
                layer.msg(message, {icon: 1});
            } else {
                layer.msg(message, {icon: 1}, foo);
            }
        },
    };
    $(document).ready(function(){
        page_init();
        var val = $('.right-side .searchMenu select').val();
        var data_value = $('.right-side .searchMenu select option[value=' + val + ']').attr('data-value');
        $('.right-side .searchMenu input').attr('placeholder', data_value);
    });
    var msg = {
        error: function(message, foo){
            if (foo == undefined) {
                layer.msg(message, {icon: 2});
            } else {
                layer.msg(message, {icon: 2}, foo);
            }
        },
        success: function(message, foo){
            if (foo == undefined) {
                layer.msg(message, {icon: 1});
            } else {
                layer.msg(message, {icon: 1}, foo);
            }
        },
    };

    $('.right-side .searchMenu select').change(function(){
        var val = $(this).val();
        var data_value = $('.right-side .searchMenu select option[value=' + val + ']').attr('data-value');
        $('.right-side .searchMenu input').attr('placeholder', data_value);
    });
    $(".left-side").niceScroll({
        styler: "fb",
        cursorcolor: "#65cea7",
        cursorwidth: '3',
        cursorborderradius: '0px',
        background: '#424f63',
        spacebarenabled: false,
        cursorborder: '0',
        autohidemode:"hidden",
    });
    $(".right-side").niceScroll({
        styler: "fb",
        cursorcolor: "#65cea7",
        cursorwidth: '3',
        cursorborderradius: '0px',
        background: '#424f63',
        spacebarenabled: false,
        cursorborder: '0',
    });

    function page_init() {
        // body...
        var path = window.location.pathname.match(/\/(\w+)(-\w+)*/g);

        var full_path = window.location.pathname.match(/\/(\w+)(-\w+)*\/(\w+)(-\w+)*/g);
        var path_select = path[0];
        if (path_select == '/player') {
            $(".left-side .menu>li").eq(0).addClass('select');
            return;
        }else if (path_select == '/play') {
            $(".left-side .menu>li").eq(1).addClass('select');
            return;
        }else if (path_select == '/coupon') {
            $(".left-side .menu>li").eq(2).addClass('select');
            return;
        }else if (full_path == '/winning/index') {
            $(".left-side .menu>li").eq(2).addClass('select');
            return;
        }else if (full_path == '/sharing-log/index') {
            $(".left-side .menu>li").eq(3).addClass('select');
            return;
        }else if (path_select == '/user') {
            $(".left-side .menu>li").eq(3).addClass('select');
            return;
        }else if (path_select == '/score') {
            $(".left-side .menu>li").eq(4).addClass('select');
            return;
        }else if (full_path == '/product/list') {
            $(".left-side .menu>li").eq(4).addClass('select');
            return;
        }
        if (path == null) {
            path = new Array();
            path[0] = '/index';
        }

        //path = reg.exec(window.location.pathname);
        //alert(path[0]);
        // 判断选中的菜单
        $(".left-side .menu>li>span").each(function () {
            var href = $(this).attr("action").match(/\/(\w+)(-\w+)*/g);
            if (path[0] == href[0]) {
                //选中当前所在栏目
                $(this).parent('li').addClass('select');
                return false;
            }
        });
    }


    var cce = new Array();
    function leftMenuHover(){
        var box = $(".left-side .menu");
        var list = $(".left-side .menu .dropdown");
        var currDropdown = null;
        var currIndex = null;
        list.hover(function(){
            var index = $(this).index();
            currIndex = index;
            var top = $(this).offset().top;
            currDropdown = $('.left-drop-menu').eq(index);
            var leftMenuHeight = $(".left-side").height();
            var dropdownHeight = currDropdown.height();
            if (leftMenuHeight < dropdownHeight + top) {
                top = top-(dropdownHeight-(leftMenuHeight-top))+30
            }
            currDropdown.css({"top":top + "px"});
            $(this).addClass('hover');
            if ($(this).hasClass('dropdown')) {
                currDropdown.show();
            }
        },function(){
            $(this).removeClass('hover');
            if ($(this).hasClass('dropdown')) {
                currDropdown.hide();
            }
        });
        $('.left-drop-menu').hover(function(){
            $(this).show();
            list.eq(currIndex).addClass('hover');
        },function(){
            $(this).hide();
            list.eq(currIndex).removeClass('hover');
        });
    }

    leftMenuHover();
    $('.sub-menu>li, .menu>li').hover(function(){
        $(this).addClass('hover');
        if ($(this).hasClass('dropdown')) {
            $(this).children('.drop-menu').show();
        }
    }, function(){
        $(this).removeClass('hover');
        if ($(this).hasClass('dropdown')) {
            $(this).children('.drop-menu').hide();
        }
    });
    $('.out').click(function(){
        layer.confirm('确认退出系统?', function(index){
            window.location.href = '/login/out';
        });
    });
    function mask() {
        layer.load(2, {
            shade: [0.5,'#fff'] //0.1透明度的白色背景
        });
    }
    function unmask() {
        layer.closeAll();
    }
</script>
</body>
</html>